function goback_apply() {
	var url1 = "http://oa.cnsuning.com/portal";
	//var url1 = "http://192.168.100.38:9082/SuNingCarWeb/";
	//var url1 = "http://oasit.cnsuning.com/portal";
	window.location=url1;
}

function goback_approve() {
	
	var url1 = "http://oa.cnsuning.com/portal";
	//var url1 = "http://oasit.cnsuning.com/portal";
	window.location=url1+"/root/workplace.jsp?workstation=true&task=taskInfo" +
	"&processType="+document.forms[0].biz_processType.value ;
}

function goback_reader() {
	var url1 = "http://oa.cnsuning.com/portal";
	//var url1 = "http://oasit.cnsuning.com/portal";
	window.location=url1+"/root/workplace.jsp?workstation=true&task=msgInfo" +
	"&processType="+document.forms[0].biz_processType.value ;
}

//apply submit ff
function submit_apply() {

	var verify=dataVerify();
	if(verify==false)
	return false;
	
	var WLeft=(window.screen.width-600)/2;
	var WTop=(window.screen.height-400)/2;
	
	var f = document.forms[0];
	var title = "";
	for (var i=0; i < f.elements.length; i++){
		e = f.elements[i];
		/**
		if (e.alt != null){
			var a = e.alt.split("#");
			if (a[0] == ""){
				title = e.value;
				break;
			}
		}
		*/
		if (e.name != null && e.name != "" && e.name.indexOf("title") != -1){
			title = e.value;
			break;
		}
	}
	document.all("biz_businessTitle").value = title;

	var openurl="processCommonSubmit.do?" +
				"processId="+document.all("biz_processId").value +
				"&businessTemplateId="+document.all("biz_businessTemplateId").value +
				"&businessCode="+document.all("biz_businessCode").value + 
				"&tkiid="+document.all("biz_tkiid").value + 
				"&title="+title + 
				"&drafterId="+document.all("biz_drafterId").value +
				"&draftDept="+document.all("biz_draftDept").value;
	
	openurl = url_addVar(openurl);
   	window.showModalDialog(openurl,window,"dialogLeft="+WLeft + "px;dialogTop=" +WTop +"px;dialogWidth=600px;dialogHeight=400px;resizable=yes;status=Yes;");
   	//window.open(openurl);
}

function url_addVar(openurl){

	var elen=document.forms[0].elements.length;
	
	for (i=0;i<elen;i++){
		e=document.forms[0].elements[i]
		if (e.type=="hidden"){
			if (e.name.substr(0,3)=="var"){
				openurl+=("&"+e.name+"="+e.value)
			}
		}
	}
	
	return openurl;
}

//approve submit
function submit_approve() {

	var verify=dataVerify();
	if(verify==false)
	return false;
	
	var WLeft=(window.screen.width-600)/2;
	var WTop=(window.screen.height-600)/2;

	var openurl="processCommonSubmit.do?tkiid="+document.all("biz_tkiid").value +
				"&processId="+document.all("biz_processId").value +
				"&businessTemplateId="+document.all("biz_businessTemplateId").value + 
				"&commentContent="+document.all("biz_commentContent").value +
 				"&drafterId="+document.all("biz_drafterId").value +
				"&draftDept="+document.all("biz_draftDept").value;
   	
	openurl = url_addVar(openurl);
   	window.showModalDialog(openurl,window,"dialogLeft="+WLeft + "px;dialogTop=" +WTop +"px;dialogWidth=600px;dialogHeight=600px;resizable=yes;status=Yes;");
   	//window.open(openurl);
}

//save the form
function save_form1() {
	
    document.forms[0].biz_save.value="true";
    
	var f = document.forms[0];
	var title = "";
	for (var i=0; i < f.elements.length; i++){
		e = f.elements[i];
		if (e.name != null && e.name != "" && e.name.indexOf("title") != -1){
			title = e.value;
			break;
		}
	}
	document.all("biz_businessTitle").value = title;
    
    var elen=document.forms[0].elements.length;
    var paramStr = "";
	for (i=0;i<elen;i++){
		e=document.forms[0].elements[i]
		if (e.type=="hidden"){
			if (e.name.substr(0,3)=="var"){
				paramStr+=e.name+"="+e.value+"/";
			}
			if (e.name.substr(0,4)=="biz_"){
				paramStr+=e.name+"="+e.value+"/";
			}
		}
	}
	paramStr=paramStr.substr(0, paramStr.length-1);
	document.all("paramStr").value=paramStr;
    document.forms[0].submit();
}

//comment
function comment_form1() {

	var WLeft=(window.screen.width-350)/2;
	var WTop=(window.screen.height-340)/2;

    window.open("processCommonComment.do?templateName="+document.forms[0].biz_templateName.value,"","left="+WLeft + ",top=" +WTop +",width=400,height=380,resizable=yes,status:= Yes;");
}

//trace
function trace_form1() {
	var WLeft=(window.screen.width-650)/2;
	var WTop=(window.screen.height-440)/2;

	var url1 = "http://ps.cnsuning.com/SuNingCarWeb";
    window.open(url1 + "/jsp/webflow/form.jsp?processId="+document.forms[0].biz_processId.value,"","left="+WLeft + ",top=" +WTop +",scrollbars=yes,width=800,height=400,resizable=yes");
}
//cancel
function cancelForm() {
    
	var WLeft=(window.screen.width-600)/2;
	var WTop=(window.screen.height-400)/2;

	var openurl="processCommonCancel.do?processId="+document.forms[0].biz_processId.value+"&processCode="+document.forms[0].biz_businessCode.value;
				
			
	openurl = url_addVar(openurl);
   	window.showModalDialog(openurl,window,"dialogLeft="+WLeft + "px;dialogTop=" +WTop +"px;dialogWidth=600px;dialogHeight=400px;resizable=yes;status=Yes;");
   	//window.open(openurl);

}
//advisable
function advise_form1() {
	var WLeft=(window.screen.width-650)/2;
	var WTop=(window.screen.height-440)/2;
	
	var title = document.all("biz_businessTitle").value;
	var tkiid = document.all("biz_tkiid").value;

	var url = "http://ps.cnsuning.com/SuNingCarWeb";
    url = url + "/jsp/processcommon/advisable.jsp?title=" + title + "&tkiid=" + tkiid;
	window.open(url,"","left="+WLeft + ",top=" +WTop +",scrollbars=yes,width=800,height=400,resizable=yes");
}
